import React from 'react';
import { inject, observer } from "mobx-react";
import { Icon, Row, Col, Modal, message } from 'antd'
import { WeaInput, WeaFormItem, WeaSelect, WeaDatePicker, WeaBrowser, WeaLocaleProvider, WeaTextarea } from 'ecCom'
import { toJS } from 'mobx';
import CubeLayout from "../../../../govern/components/E9/cubeLayout";
import * as Util from "../../../util/Util";
const getLabel = WeaLocaleProvider.getLabel;
@inject('goalDetailStore','goalCommonStore')
@observer
export default class GoalBaseFiled extends React.Component {

    constructor(props) {
        super(props);
        this.state = {
            ...props,
            // detailKey:'',
            viewHeight: Util.getCurrentHeight(),
        },
            this.optionsState = [
                {
                    key: "1",
                    selected: true,
                    showname: getLabel(1960, '进行中'),
                },
                {
                    key: "2",
                    selected: false,
                    showname: getLabel(23774, '已完成')
                },
                {
                    key: "3",
                    selected: false,
                    showname: getLabel(1981, '已撤销')
                },
            ];
        this.optionsPeriod = [
            // {
            //     key: "",
            //     showname: ""
            // },
            {
                key: "1",
                selected: true,
                showname: getLabel(19398, '月度')
            },
            {
                key: "2",
                selected: false,
                showname: getLabel(17495, '季度')
            },
            {
                key: "3",
                selected: false,
                showname: getLabel(17138, '年度')
            },
            {
                key: "4",
                selected: false,
                showname: getLabel(390757, '三年')
            },
            {
                key: "5",
                selected: false,
                showname: getLabel(390758, '五年')
            },
        ];
    }

    componentDidMount(){
        const { goalDetailStore } = this.props;
        goalDetailStore.loading = false;
    }

    //更新非浏览按钮的值  specialFields 建模特殊字段设置 fieldmark建模字段表示
    inputChange = (name, value, type, nValue, specialFields, fieldmark) => {
        const { goalDetailStore } = this.props;
        let { detailData, detailKey } = goalDetailStore;
        let _goalId = detailKey;
        if (name == 'showorder' || name == 'target' || name == 'result') {
            if (!this.isNumber(value) && !Util.isEmpty(value)) {
                detailData.canedit = false;
                message.warning(getLabel(508795, '请输入数字'));
                detailData[name] = "";
                detailData.canedit = true;
                if (fieldmark) {
                    ModeForm.changeFieldValue(fieldmark, { value: "" })
                }
                return;
            }
            if (value >= 100000000) {
                detailData.canedit = false;
                message.warning(getLabel(513087, '请输入小于1亿的数字，且只能保留两位小数'));
                detailData[name] = "";
                detailData.canedit = true;
                if (fieldmark) {
                    ModeForm.changeFieldValue(fieldmark, { value: "" })
                }
                return "";
            }
            if (value.indexOf(".") != -1) {
                value = parseFloat(value).toFixed(2);
            }
        }
        if (name == 'name' && Util.isBlank(value)) {
            message.warning(getLabel('508796', '目标名称不能为空'))
            return;
        }
        if (name == 'parentid') {
            detailData.parentGoal[0] = { id: value, name: nValue }
        }
        let _this = this;
        if (name == 'period' && value != detailData[name]) {  //周期 日期字段联动
            detailData[name] = value;
            let params = {
                goalId: _goalId,
                fieldname: name,
                fieldtype: type,
                fieldvalue: value,
                doback: () => {
                    detailData['enddate'] = Util.computeEndDate(value)
                    let params = {
                        goalId: _goalId,
                        fieldname: 'enddate',
                        fieldtype: '',
                        fieldvalue: Util.computeEndDate(value),
                        isNotMessage: true,
                        doback: function () {
                            _this.doCallBack(name);
                        }
                    }
                    if (specialFields) { //建模字段值的设置
                        let datevalue = Util.computeEndDate(value);
                        for (let i in specialFields) {
                            if (specialFields[i]["fieldname"] == "enddate") {
                                ModeForm.changeFieldValue(i, { value: datevalue })
                            }
                        }
                    }
                    goalDetailStore.editGoalField(params);
                }
            }
            goalDetailStore.editGoalField(params);
            return;
        }
        if (value != detailData[name]) {
            detailData[name] = value;
            let params = {
                goalId: _goalId,
                fieldname: name,
                fieldtype: type,
                fieldvalue: value,
                doback: function () {
                    _this.doCallBack(name);
                }
            }
            goalDetailStore.editGoalField(params);
        }
    }


    //更新浏览按钮  参与人  负责人  分享人 ,上级目标
    browserChange = (type, ids, names, datas, fieldname) => {
        const { goalDetailStore } = this.props;
        let { detailData,detailKey } = goalDetailStore;
        let originValue = Util.operateSymbol(detailData[fieldname],",","del"); //获得原始值，移除前后逗号
        if (originValue == ids) { 
            return;
        }
        let _this = this;
        let params = {
            goalId:detailKey,
            fieldname: '',  //字段名字
            fieldtype: '',  //类型
            fieldvalue: '',  //字段值
            logDelvalue: '', //日志删除值
            logAddValue: '', //日志增加值
            operateType: '', //操作类型
            doback: function (code,msg) {
                if(code == 2){
                    detailData[fieldname] = "";
                    detailData[type] = [];
                    Modal.warning({
                        title: getLabel('558', '提示'),
                        content: msg
                    });
                }else{
                    _this.doCallBack(fieldname);
                }
            }
        };
        if (type == 'principalid_arr' && Util.isEmpty(ids)) {
            Modal.warning({
                title: getLabel('558', '提示'),
                content: getLabel('508801', '责任人不能为空'),
            });
            return;
        }
        if (type == 'principalid_arr' || type == 'partnerid_arr' || type == 'sharerid_arr') {
            params.fieldvalue = ids;
            detailData[type] = datas;
            if (type != 'principalid_arr') {
                params.fieldvalue = Util.operateSymbol(params.fieldvalue,",","add");//获取操作后的值，添加前后逗号
            } 
            params.logDelvalue = Util.ArrayDiffer(detailData[fieldname], params.fieldvalue, 1); //删除的值
            params.logAddValue = Util.ArrayDiffer(detailData[fieldname], params.fieldvalue.split(','), 2); //增加的值
        } 
        params.fieldname = fieldname;
        detailData[fieldname] = params.fieldvalue;
        goalDetailStore.editGoalField(params);
    }
    //回调函数,调用GoalDetail函数
    doCallBack = (type) => {
        if (typeof this.props.doCallBack === "function") {
            this.props.doCallBack(type);
        }
    }

    //建模input框的改变
    onInputChange = (values, type, specialFields, tablename, fieldmark, browserShowName) => {//input select textare保存
        if (type != "parentid") {
            this.inputChange(type, values, "", "", specialFields, fieldmark);
        }
    }

    //建模特殊字段处理
    getEcmeFieldData = (path, param) => {
        const { goalDetailStore: { cubeLayoutParame, detailData, optionTypes, detailKey } } = this.props;
        const { specialFields } = cubeLayoutParame;
        if (_.has(specialFields, path)) {
            if (specialFields[path].fieldname == 'parentid') {
                return <WeaBrowser ecId={`${this && this.props && this.props.ecId || ''}_WeaBrowser@pltpog`} title={getLabel(19709, '上级目标')}
                    onChange={(ids, names, datas) => { this.inputChange('parentid', ids, '', names) }}
                    replaceDatas={toJS(detailData.parentGoal)} icon ="icon-coms-implement"
                    iconBgcolor="rgb(150, 53, 138)"
                    type="wrlgoal" viewAttr={detailData.canedit? 2 : 1} inputStyle={{ width: 245 }}
                    onLinkClick={() => { this.onNodeClick(detailData.parentGoal[0].id) }}
                    dataParams={{ parentid: detailKey }}
                    hasAdvanceSerach={true}
                    completeParams={{ parentid: detailKey }} />
            }
            if (specialFields[path].fieldname == 'partnerid' || specialFields[path].fieldname == 'sharerid') {
                let _title = getLabel(382557, '参与人');
                let _carray = "partnerid_arr";
                if (specialFields[path].fieldname == 'sharerid') {
                    _title = getLabel(382597, '分享人');
                    _carray = "sharerid_arr";
                }
                return <WeaBrowser ecId={`${this && this.props && this.props.ecId || ''}_WeaBrowser@96h5w6`} title={_title}
                    onChange={(ids, names, datas) => { this.browserChange(_carray, ids, names, datas, specialFields[path].fieldname) }}
                    replaceDatas={toJS(detailData[_carray])} isSingle={false}
                    type="17" viewAttr={detailData.canedit? 2 : 1} inputStyle={{ width: 245 }} />
            }
            if (specialFields[path].fieldname == 'principalid') {
                let _title = getLabel(16936, '责任人')
                let _carray = "principalid_arr";
                return <WeaBrowser ecId={`${this && this.props && this.props.ecId || ''}_WeaBrowser@g6ruha`} title={_title}
                    onChange={(ids, names, datas) => { this.browserChange(_carray, ids, names, datas, specialFields[path].fieldname) }}
                    replaceDatas={toJS(detailData[_carray])}
                    type="1" viewAttr={detailData.caneditPrincial? 2 : 1} inputStyle={{ width: 245 }} />
            }
            if (specialFields[path].fieldname == 'cateid') {
                return <WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@e2mrcn`}
                    options={optionTypes}
                    value={detailData.cateid}
                    viewAttr={detailData.canedit ? 2 : 1}
                    onChange={(v, showname) => {
                        this.inputChange("cateid", v)
                    }}
                    style={{ width: 245 }}
                />
            }
            if (specialFields[path].fieldname == 'status') {
                return <WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@571x6l`}
                    options={this.optionsState}
                    value={detailData.status}
                    viewAttr={detailData.canedit ? 2 : 1}
                    onChange={(v, showname) => {
                        this.inputChange("status", v)
                    }}
                    style={{ width: 245 }}
                />
            }
        }
        return null;
    }

    ecmeCallBack = () => {
        const { goalDetailStore } = this.props;
        goalDetailStore.cubeLoading = false;
    }

    //type-onChange onblur onfoncus fieldname-更改的字段 tablename-更改的表名 fieldhtmltype-更改字段类型 newvalue-更改后的值 rowIndex-明细表主键id
    ecmeFieldEventCallBack = (datas) => {
        let { goalDetailStore: { cubeLayoutParame } } = this.props;
        let { specialFields } = cubeLayoutParame;
        let type = datas.changetype;
        let fieldInfo = datas.fieldInfo;
        let fieldname = fieldInfo.fieldname;
        let fieldhtmltype = fieldInfo.fieldhtmltype;
        let tablename = fieldInfo.tablename;
        let newvalue = datas.fieldnewvalue;
        let fieldmark = datas.fieldMark;
        let iscustom = datas.iscustom;
        let rowIndex = datas.rowIndex;
        let isCallBack = false;
        if (ModeForm.getFieldCurViewAttr(datas.fieldMark) == 3 && Util.isEmpty(newvalue) && type != "onfocus") {
            message.warning(getLabel(509065, '请输入必填项'));
            return;
        }
        if (fieldhtmltype == 1 || fieldhtmltype == 2) {
            if (type == "onblur") {
                isCallBack = true;
            }
        } else if (type == "onChange") {
            isCallBack = true;
        }
        if (isCallBack) {
            if (iscustom == "true") {
                let logValue = newvalue;
                if (fieldhtmltype == 3) {//浏览按钮
                    if(datas.browserShowName != ""){
                        logValue = datas.browserShowName;
                    }
                }
                if (fieldhtmltype == 4) {//复选框
                    logValue = newvalue == 0 ? "No" : "Yes";
                }
                if (fieldhtmltype == 5) {//下拉框
                    logValue = this.getCustomeSelectName(newvalue, fieldInfo.options);
                }
                let labeltype = fieldInfo.labeltype;
                let show_name = fieldInfo.fieldlabelid;
                if (labeltype == 1) {
                    show_name = fieldInfo.showname;
                }
                this.onCustomChange(newvalue, fieldname, tablename, fieldmark, labeltype, show_name, logValue, fieldhtmltype);
            } else {
                this.onInputChange(newvalue, fieldname, specialFields, tablename, fieldmark, datas.browserShowName);
            }
        }
    }
    //自定义字段下拉选择框得到showname
    getCustomeSelectName(val, datas) {
        let showname = val;
        datas && datas.length > 0 && datas.map((element, idx) => {
            if (element.key == val) {
                showname = element.showname;
            }
        })
        return showname;
    }

    //自定义字段保存
    onCustomChange = (values, type, tablename, fieldmark, labeltype, show_name, logValue, fieldhtmltype) => {
        const { goalDetailStore } = this.props;
        // const { detailKey } = this.state;
        let { detailData, detailKey } = goalDetailStore;
        if (detailData[type] != values) {
            detailData[type] = values;
            goalDetailStore.editGoalField({
                goalId: detailKey, fieldname: type, fieldvalue: values, fieldmark: fieldmark, labeltype: labeltype, logValue: logValue,
                showname: show_name, tablename: tablename, iscustom: "1", fieldhtmltype: fieldhtmltype
            });
        }
    }

    //重置导航栏的地址值
    resetUrlKey() {
        //弹框更改url上的_key值
        const { pathname, search } = this.props;
        let url = `/${pathname}${search}`;
        if (pathname == undefined || search == undefined) {
            url = "/main/workrelate/goal/goalIndex";
        }
        this.context.router.push({
            pathname: url
        });
    }

    //判断是否为数字
    isNumber = (val) => {
        var regPos = /^\d+(\.\d+)?$/; //非负浮点数
        var regNeg = /^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$/; //负浮点数
        if (regPos.test(val) || regNeg.test(val)) {
            return true;
        } else {
            return false;
        }
    }

    onNodeClick = (key) =>{
        if(typeof this.props.onNodeClick === 'function'){
            this.props.onNodeClick(key);
        }
    }

    render() {
        const { goalDetailStore } = this.props;
        const { loading, detailData, hasRight, optionTypes, detailKey, iconType, isOrgGoal } = goalDetailStore;
        const { viewHeight } = this.state;
        let { cubeLayoutParame, getCardStorefun } = goalDetailStore;
        let cubeFlag = Object.keys(toJS(cubeLayoutParame)).length > 0;
        return (
            <div className="wea-search-group">
                <div className="workrelate-goal-content">
                    {(cubeFlag && !isOrgGoal) ? (CubeLayout({ cubeLayoutParame, "getEcmeFieldData": this.getEcmeFieldData, "callback": this.ecmeCallBack, "ecmeFieldEventCallBack": this.ecmeFieldEventCallBack, getCardStorefun })) :
                        <div>
                            <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@egfsi7`}>
                                <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@wt5rtg`} label={getLabel('33439', '名称')} labelCol={{ span: 6 }} wrapperCol={{ span: 18 }}>
                                    <WeaInput ecId={`${this && this.props && this.props.ecId || ''}_WeaInput@7yoqhw`}
                                        value={detailData.name}
                                        onBlur={(value) => this.inputChange("name", value)}
                                        viewAttr={detailData.canedit? 3 : 1}
                                    />
                                </WeaFormItem>
                            </Row>
                            <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@blypph`} className="workrelate-goal-content-parentgoal">
                                <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@gp2av7`} label={getLabel(19709, '上级目标')} labelCol={{ span: 6 }} wrapperCol={{ span: 18 }}>
                                    <WeaBrowser ecId={`${this && this.props && this.props.ecId || ''}_WeaBrowser@sltssr`}
                                        replaceDatas={toJS(detailData.parentGoal)}
                                        type='wrlgoal'
                                        textDecoration={true}
                                        inputStyle={{ width: 200 }}
                                        onChange={(ids, names, datas) =>
                                            this.inputChange('parentid', ids, '', names)
                                        }
                                        hasAdvanceSerach={true}
                                        viewAttr={detailData.canedit? 2 : 1}
                                        onLinkClick={() => { this.onNodeClick(detailData.parentGoal[0].id) }}
                                        title={getLabel(19709, '上级目标')}
                                        icon ="icon-coms-implement"
                                        iconBgcolor="rgb(150, 53, 138)"
                                        dataParams={{ parentid: detailKey }}
                                        completeParams={{ parentid: detailKey }}
                                    />
                                </WeaFormItem>
                            </Row>
                            <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@v853ug`}>
                                <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@2s7d9u`} label={getLabel(500401, '类型')} labelCol={{ span: 6 }} wrapperCol={{ span: 18 }}>
                                    <WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@mad4tz`}
                                        options={optionTypes}
                                        value={detailData.cateid}
                                        viewAttr={detailData.canedit? 2 : 1}
                                        onChange={(v, showname) => {
                                            this.inputChange("cateid", v)
                                        }}
                                    />
                                </WeaFormItem>
                            </Row>
                            <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@68e1x4`}>
                                <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@w42702`} label={getLabel(23247, '状态')} labelCol={{ span: 6 }} wrapperCol={{ span: 18 }}>
                                    <WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@995699`}
                                        options={this.optionsState}
                                        value={detailData.status}
                                        viewAttr={detailData.canedit? 2 : 1}
                                        onChange={(v, showname) => {
                                            this.inputChange("status", v)
                                        }}
                                    />
                                </WeaFormItem>
                            </Row>
                            <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@jaz98f`}>
                                <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@vqzb04`} label={getLabel(433, '描述')} labelCol={{ span: 6 }} wrapperCol={{ span: 18 }}>
                                    <WeaTextarea ecId={`${this && this.props && this.props.ecId || ''}_WeaTextarea@v5ng20`}
                                        value={detailData.remark}
                                        onBlur={(value) => this.inputChange("remark", value)}
                                        viewAttr={detailData.canedit? 2 : 1}
                                    />
                                </WeaFormItem>
                            </Row>
                            <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@9i3h79`}>
                                <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@6n9jao`} label={getLabel(18087, '目标值') + "(" + getLabel(1329, '单位') + ")"} labelCol={{ span: 6 }} wrapperCol={{ span: 18 }}>

                                    {detailData.canedit? <div><WeaInput ecId={`${this && this.props && this.props.ecId || ''}_WeaInput@62j8os`} className="workrelate-goal-input-value"

                                        value={detailData.target}
                                        onBlur={(e) => this.inputChange("target", e)}
                                        // onChange={(e) => this.inputChange("target",e)}
                                        viewAttr={detailData.canedit? 2 : 1}
                                    //filter = {(value) => this.checkValue(value)}
                                    // precision={2}
                                    />
                                        <WeaInput ecId={`${this && this.props && this.props.ecId || ''}_WeaInput@1v4ebu`} className="workrelate-goal-input-unit"
                                            value={detailData.tunit}
                                            onBlur={(value) => this.inputChange("tunit", value)}
                                        /></div> : <div>{detailData.target ? detailData.target : "" }{ detailData.tunit ? "("+ detailData.tunit +")" : ''}</div>}
                                </WeaFormItem>
                            </Row>
                            <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@h9llai`}>
                                <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@aps3q9`} label={getLabel(508618, '完成值') + "(" + getLabel(1329, '单位') + ")"} labelCol={{ span: 6 }} wrapperCol={{ span: 18 }}>
                                    {detailData.canedit? <div><WeaInput ecId={`${this && this.props && this.props.ecId || ''}_WeaInput@febkl2`} className="workrelate-goal-input-value"
                                        value={detailData.result}
                                        onBlur={(e) => this.inputChange("result", e)}
                                        // onChange={(e) => this.inputChange("result",e)}
                                        viewAttr={detailData.canedit? 2 : 1}
                                    //filter = {(value) => this.checkValue(value)}
                                    // precision={2}
                                    />
                                        <WeaInput ecId={`${this && this.props && this.props.ecId || ''}_WeaInput@8od5cz`} className="workrelate-goal-input-unit"
                                            value={detailData.runit}
                                            onBlur={(value) => this.inputChange("runit", value)}
                                        /></div> : <div>{detailData.result ? detailData.result : "" }{detailData.runit ? "("+ detailData.runit +")": ''}</div>}
                                </WeaFormItem>
                            </Row>
                            <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@nfpyib`}>
                                <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@5j162o`} label={getLabel(30447, '完成率')} labelCol={{ span: 6 }} wrapperCol={{ span: 18 }}>
                                    <WeaInput ecId={`${this && this.props && this.props.ecId || ''}_WeaInput@pk6f34`}
                                        value={detailData.rate}
                                        onBlur={(value) => this.inputChange("rate", value)}
                                        viewAttr={detailData.canedit? 2 : 1}
                                    />
                                </WeaFormItem>
                            </Row>
                            <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@agwraf`}>
                                <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@aoioel`} label={getLabel(16936, '责任人')} labelCol={{ span: 6 }} wrapperCol={{ span: 18 }}>
                                    <WeaBrowser ecId={`${this && this.props && this.props.ecId || ''}_WeaBrowser@us01cn`}
                                        replaceDatas={toJS(detailData.principalid_arr)}
                                        type={1}
                                        textDecoration={true}
                                        inputStyle={{ width: 200 }}
                                        onChange={(ids, names, datas) =>
                                            this.browserChange('principalid_arr', ids, names, datas, 'principalid')
                                        }
                                        viewAttr={ detailData.caneditPrincial ? 2 : 1}
                                        title={getLabel(16936, '责任人')}
                                    />
                                </WeaFormItem>
                            </Row>
                            <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@cjdrxu`}>
                                <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@yzba2k`} label={getLabel(15761, '参与人')} labelCol={{ span: 6 }} wrapperCol={{ span: 18 }}>
                                    <WeaBrowser ecId={`${this && this.props && this.props.ecId || ''}_WeaBrowser@bjn93s`}
                                        replaceDatas={toJS(detailData.partnerid_arr)}
                                        type={17}
                                        textDecoration={true}
                                        inputStyle={{ width: 200 }}
                                        onChange={(ids, names, datas) =>
                                            this.browserChange('partnerid_arr', ids, names, datas, 'partnerid')
                                        }
                                        viewAttr={detailData.canedit? 2 : 1}
                                        isSingle={false}
                                        title={getLabel(15761, '参与人')}
                                    />
                                </WeaFormItem>
                            </Row>
                            {!isOrgGoal && <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@gy8xw6`}>
                                <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@vngimr`} label={getLabel(382597, '分享给')} labelCol={{ span: 6 }} wrapperCol={{ span: 18 }}>
                                    <WeaBrowser ecId={`${this && this.props && this.props.ecId || ''}_WeaBrowser@19flhr`}
                                        replaceDatas={toJS(detailData.sharerid_arr)}
                                        type={17}
                                        textDecoration={true}
                                        inputStyle={{ width: 200 }}
                                        onChange={(ids, names, datas) =>
                                            this.browserChange('sharerid_arr', ids, names, datas, 'sharerid')
                                        }
                                        viewAttr={detailData.canedit? 2 : 1}
                                        isSingle={false}
                                        title={getLabel(382597, '分享给')}
                                    />
                                </WeaFormItem>
                            </Row>}
                            <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@ccetqt`}>
                                <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@xg3osj`} label={getLabel(15386, '周期')} labelCol={{ span: 6 }} wrapperCol={{ span: 18 }}>
                                    <WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@9kj4dd`}
                                        options={this.optionsPeriod}
                                        value={detailData.period}
                                        onChange={(v, showname) => {
                                            this.inputChange("period", v)
                                        }}
                                        viewAttr={detailData.canedit? 2 : 1}
                                    />
                                </WeaFormItem>
                            </Row>
                            <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@raynft`}>
                                <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@2urki1`} label={getLabel(741, '结束日期')} labelCol={{ span: 6 }} wrapperCol={{ span: 18 }}>
                                    <WeaDatePicker ecId={`${this && this.props && this.props.ecId || ''}_WeaDatePicker@9tu0e8`}
                                        value={detailData.enddate}
                                        onChange={(v) => {
                                            this.inputChange("enddate", v)
                                        }}
                                        viewAttr={detailData.canedit? 2 : 1}
                                    />
                                </WeaFormItem>
                            </Row>
                            <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@wp9gam`}>
                                <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@h0gtlk`} label={getLabel(338, '排序')} labelCol={{ span: 6 }} wrapperCol={{ span: 18 }}>
                                    <WeaInput ecId={`${this && this.props && this.props.ecId || ''}_WeaInput@9e9l6t`}
                                        value={detailData.showorder == '' ? '' : parseInt(detailData.showorder)}
                                        onBlur={(e) => {
                                            this.inputChange("showorder", e)
                                        }}
                                        viewAttr={detailData.canedit? 2 : 1}
                                    //filter = {(value) => this.checkValue(value)}
                                    />
                                </WeaFormItem>
                            </Row>
                        </div>}
                </div>
            </div>
        )
    }
}